package pl.edu.pw.MidEmu.Samples.MidasChat;

import midas.mw.interfaces.Application;
import midas.mw.interfaces.Mw;
import pl.edu.pw.MidEmu.Integration.MidEmuApplication;
import pl.edu.pw.MidEmu.Samples.MidasChat.UI.Components.MIDASChatFrame;

/**
 * Main class for MIDAS context chat application
 * This class is handled by MIDAS Middleware
 * @author Mateusz Starodab
 *
 */
public class MIDASChat implements Application
{
	@Override
	/**
	 * Method invoked by Middleware to start application instance
	 */
	public int start(Mw middlewareInterface, String[] args)
	{
		if (MidEmuApplication.getInstance().init(args) != 0)
			return 1;

		MIDASChatFrame frame = new MIDASChatFrame(middlewareInterface);
		frame.getComponent().setVisible(true);

		return 0;
	}

	@Override
	/**
	 * Method invokled by Middleware to stop application instance
	 */
	public int stop()
	{
		System.out.println("Midas mnie zatrzymal!");
		return 0;
	}
}